﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using VCN.App.DataAccessLayer;

namespace VCN.home
{
    public partial class ListProducts : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int v_i_category_id;
                ProductDAO v_ProductDAO = new ProductDAO();
                if (Request.QueryString["CateId"] != null)
                {
                    v_i_category_id = Int32.Parse(Request.QueryString["CateId"]);
                    m_rpt_list_products.DataSource = v_ProductDAO.SelectByCategoryId(v_i_category_id);
                    this.Title = "Products List";
                }
                else 
                    m_rpt_list_products.DataSource = v_ProductDAO.selectAll2Dt();
                m_rpt_list_products.DataBind();
            }
        }
    }
}
